package lib.paxos;

import java.io.File;
import java.io.IOException;
import java.util.List;

import lib.messaging.NetworkAddress;

/**
 * Inteface exposed by Acceptor in a Paxos group to manipulate it's state
 * @author abhip
 *
 */
public interface IAcceptorState
{
    AcceptMessage AcceptedMessage();

    void AddServerToListOfKnownServers(NetworkAddress serverAddress);

    int CurrentRoundID();

    void DumpAcceptorStateToFile(File outputFile) throws IOException;
    List<NetworkAddress> GetOtherServerAddresses();

    RoundInfo GetRoundInfo(int roundID) throws PaxosException;

    int GetTotalNumberOfCommands();

    SequenceID HighestKnownSeqID();

    boolean IsCommandChosenForCurrentRound() throws PaxosException;

    boolean IsCommandDecidedForRound(int roundID) throws PaxosException;

    List<NetworkAddress> NextEpochServerAddresses();

    void SetNextEpochServerAddresses(List<NetworkAddress> nextEpochServerAddresses);

    void SetOtherServerAddresses(List<NetworkAddress> otherServerAddresses);

    void UpdateAcceptorState(
            int currentRoundID,
            SequenceID highestKnownSeqID,
            AcceptMessage acceptedMessage,
            List<RoundInfo> missingRoundInfos) throws PaxosException;
}
